<html>
<head><meta charset="utf-8"><title>Borrow Checker Question · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Borrow.20Checker.20Question.html">Borrow Checker Question</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="203437321"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Borrow%20Checker%20Question/near/203437321" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nell Shamrell-Harrington <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Borrow.20Checker.20Question.html#203437321">(Jul 09 2020 at 20:39)</a>:</h4>
<p>Hello!</p>
<p>I'm working on a talk that, among other things, covers some of the internals of the borrow checker.</p>
<p>I have a question re: move paths and places when the checker is tracing moves and initializations. I know that an MIR visitor called the Gatherer walks the MIR and looks at how each Place is accessed. Then, for each place, the Gatherer constructs a MovePathIndex.</p>
<p>When I am looking at the MIR output and I see something like this:</p>
<div class="codehilite"><pre><span></span><code>StorageLive(_20);                // bb6[8]: scope 2 at src/main.rs:5:14: 5:18
        StorageLive(_21);                // bb6[9]: scope 2 at src/main.rs:5:14: 5:18
        _21 = _22;                       // bb6[13]: scope 2 at src/main.rs:5:14: 5:18
        _20 = move _21 as &amp;[&amp;str] (Pointer(Unsize)); // bb6[14]: scope 2 at src/main.rs:5:14: 5:18
</code></pre></div>


<p>are the values designated as _20, _21, etc. the places that the Gatherer checks?</p>



<a name="203442385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Borrow%20Checker%20Question/near/203442385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Borrow.20Checker.20Question.html#203442385">(Jul 09 2020 at 21:21)</a>:</h4>
<p><code>_123</code> are locals</p>



<a name="203442516"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Borrow%20Checker%20Question/near/203442516" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Borrow.20Checker.20Question.html#203442516">(Jul 09 2020 at 21:22)</a>:</h4>
<p>a place is a local and optionally projections into that local (like field accesses)</p>



<a name="203442565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Borrow%20Checker%20Question/near/203442565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Borrow.20Checker.20Question.html#203442565">(Jul 09 2020 at 21:22)</a>:</h4>
<p>so <code>(_123[4].5.x as Variant).variant_field</code> is an extreme example</p>



<a name="203442606"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Borrow%20Checker%20Question/near/203442606" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Borrow.20Checker.20Question.html#203442606">(Jul 09 2020 at 21:23)</a>:</h4>
<p>in your example all the places are as simple as they can be (just locals)</p>



<a name="203442666"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Borrow%20Checker%20Question/near/203442666" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Borrow.20Checker.20Question.html#203442666">(Jul 09 2020 at 21:23)</a>:</h4>
<p>if you look at the top of the function in the MIR, you'll see on <code>let</code> per local (except arguments which are listed between the parens of <code>fn foo(....)</code>)</p>



<a name="203448527"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Borrow%20Checker%20Question/near/203448527" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nell Shamrell-Harrington <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Borrow.20Checker.20Question.html#203448527">(Jul 09 2020 at 22:16)</a>:</h4>
<p>ty!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>